package com.yesep.learn.design.structural.decorator;

import com.yesep.learn.design.common.*;

/**
 * 播放器字幕装饰器
 */
public class MediaPlayerSubtitleDecorator extends MediaPlayerDecorator {
    public MediaPlayerSubtitleDecorator(IMediaPlayer adapter) throws Exception {
        super(adapter);
    }

    @Override
    public void play(String fileName) {
        super.play(fileName);
        addSubtitle();
    }

    /**
     * 添加字幕等扩展操作
     */
    private void addSubtitle() {
        System.out.printf("add media player subtitle for %s. \n", getFileName());
    }
}
